#include <bits/stdc++.h>
using namespace std;

using big = __int128;

big row(big n, big m) {
    return n * m * (n + m - 2);
}

big knight(big n, big m) {
    return (max(n - 2, big(0)) * max(m - 3, big(0)) + max(n - 3, big(0)) * max(m - 2, big(0))) * 4;
}

big diagonal(big n, big m) {
    if(n > m) swap(n, m);
    return (n * (n - 1) * (2 * n - 1) / 3 + n * n * (m - n + 1) - n * m) * 2;
}

void printAns(big x) {
    if(x == 0) return;
    printAns(x / 10);
    cout << (int)(x % 10);
}

int main() {
    ios::sync_with_stdio(false);
    cin.tie(0);

    int n, m;
    cin >> n >> m;
    long long ans = 0;
    for(int i = 1; i <= n; i ++)
        for(int j = 1; j <= m; j ++)
            for(int k = 1; k <= n; k ++)
                for(int l = 1; l <= m; l ++)
                    if(i != k && j != l && i + j != k + l && i - j != k - l && (min(abs(i - k), abs(j - l)) != 1 || max(abs(i - k), abs(j - l)) != 2))
                        ans ++;
    cout << ans;
}